<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动态时钟</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    
    <!-- 配置Tailwind自定义颜色和字体 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        dark: '#1E293B',
                    },
                    fontFamily: {
                        digital: ['Courier New', 'monospace'],
                    },
                }
            }
        }
    </script>
    
    <style type="text/tailwindcss">
        @layer utilities {
            .text-shadow {
                text-shadow: 0 2px 4px rgba(0,0,0,0.1);
            }
            .clock-container {
                backdrop-filter: blur(8px);
            }
        }
    </style>
</head>
<body class="bg-gradient-to-br from-slate-900 to-indigo-950 min-h-screen flex items-center justify-center p-4">
    <div class="clock-container bg-white/10 rounded-2xl p-8 md:p-12 shadow-2xl border border-white/20 max-w-3xl w-full">
        <div class="flex flex-col items-center">
            <!-- 时钟图标 -->
            <div class="mb-6 text-primary text-5xl animate-pulse">
                <i class="fa fa-clock-o" aria-hidden="true"></i>
            </div>
            
            <!-- 日期显示 -->
            <div id="date" class="text-white text-xl md:text-2xl font-light mb-4 tracking-wide"></div>
            
            <!-- 时间显示 -->
            <div id="time" class="text-white font-digital text-4xl md:text-6xl lg:text-7xl font-bold tracking-tighter text-shadow"></div>
            
            <!-- 星期显示 -->
            <div id="weekday" class="text-primary/90 text-lg md:text-xl mt-4 font-medium"></div>
        </div>
    </div>

    <script>
        // 获取DOM元素
        const dateElement = document.getElementById('date');
        const timeElement = document.getElementById('time');
        const weekdayElement = document.getElementById('weekday');
        
        // 星期几的中文名称
        const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
        
        // 更新时间的函数
        function updateTime() {
            // 获取当前时间
            const now = new Date();
            
            // 获取年、月、日
            const year = now.getFullYear();
            const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始，所以加1
            const day = String(now.getDate()).padStart(2, '0');
            
            // 获取星期几
            const weekday = weekdays[now.getDay()];
            
            // 获取时、分、秒，并补零
            const hours = String(now.getHours()).padStart(2, '0');
            const minutes = String(now.getMinutes()).padStart(2, '0');
            const seconds = String(now.getSeconds()).padStart(2, '0');
            
            // 更新DOM内容
            dateElement.textContent = `${year}年${month}月${day}日`;
            timeElement.textContent = `${hours}:${minutes}:${seconds}`;
            weekdayElement.textContent = weekday;
        }
        
        // 立即更新一次时间
        updateTime();
        
        // 每秒更新一次时间
        setInterval(updateTime, 1000);
    </script>
</body>
</html>
